import App from '@/App'

import index from './pages/index/index.vue'
import device from './pages/device/device.vue'
import maintenance from './pages/maintenance/maintenance.vue'
import consumables from './pages/consumables/consumables.vue'

import messages from '@/locale/index'

let i18nConfig = {
  locale: uni.getLocale(),// 获取已设置的语言
  messages
}

// #ifndef VUE3
import Vue from 'vue'
import '@/uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import { createI18n } from 'vue-i18n'// v9.x
const i18n = createI18n(i18nConfig)
import router from '@/router'
import * as Pinia from 'pinia'
import { createUnistorage } from 'pinia-plugin-unistorage'
const pinia = Pinia.createPinia()
const piniaUnistorage = createUnistorage()
pinia.use(piniaUnistorage)
export function createApp() {
  const app = createSSRApp(App)
  
  app.component('home',index)
  app.component('articlelist',device)
  app.component('news',maintenance)
  app.component('my',consumables)
  
  app.use(i18n)
  app.use(router)
  app.use(pinia)
  return {
    app
  }
}
// #endif